Start & update process bots keyword#3421
Merged
GuillaumeDSM merged 2 commits intodevfrom May 2, 2026
Merged
Conversation
3aeb49a to
090b180
Compare
f78183a to
f8002e4
Compare
a305f78 to
cc89815
Compare
Herklos
reviewed
May 1, 2026
Contributor
Herklos
left a comment
There was a problem hiding this comment.
Awesome tests !!! Great job 💯
Comment on lines
+206
to
+208
| # Web automation: child process sets OCTOBOT_WEB_API_KEY | ||
| ENV_WEB_API_KEY = "OCTOBOT_WEB_API_KEY" | ||
| WEB_API_KEY_HEADER = "X-Octobot-Api-Key" |
Member
Author
There was a problem hiding this comment.
No, indeed, I'll remove it !
Comment on lines
+108
to
+110
| # optional path for periodic ProcessBotState JSON (see cli --dump-state) | ||
| self.dump_state_path = None | ||
| self._process_bot_state_dump_task = None |
Contributor
There was a problem hiding this comment.
Should it be moved inside taskManager?
| @staticmethod | ||
| def reject_user_path_segment(path_value: str) -> None: | ||
| """Reject obvious path traversal in user-supplied relative paths.""" | ||
| if ".." in pathlib.PurePath(path_value).parts: |
Comment on lines
+116
to
+124
| def _tcp_port_is_free(bind_host: str, port: int) -> bool: | ||
| """True if nothing is currently bound to (host, port) for TCP.""" | ||
| with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: | ||
| sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | ||
| try: | ||
| sock.bind((bind_host, port)) | ||
| except OSError: | ||
| return False | ||
| return True |
Contributor
There was a problem hiding this comment.
Shouldn't we create an util method in commons.os_util and use it here?
Comment on lines
+138
to
+146
| for offset_from_base in range(max_offset): | ||
| listen_port = listen_port_base + offset_from_base | ||
| if blocklist and listen_port in blocklist: | ||
| continue | ||
| if not ProcessBoundOperatorMixin._tcp_port_is_free( | ||
| bind_host_for_probe, listen_port | ||
| ): | ||
| continue | ||
| return listen_port |
Contributor
There was a problem hiding this comment.
Same (commons.os_util) as previous comment
| 50200, | ||
| blocklist=[50200], | ||
| ) | ||
| assert listen_port == 50201 |
|
|
||
|
|
||
| @dataclasses.dataclass | ||
| class ProcessBotState(octobot_commons.dataclasses.MinimizableDataclass): |
Contributor
There was a problem hiding this comment.
Shouldn't it be placed in commons as it is also used by "octobot" package?
| @@ -0,0 +1 @@ | |||
| # Subpackage for octobot_process functional tests. | |||
Comment on lines
+278
to
+302
| if run_action_details is not None: | ||
| inner_after = octobot_process_functional_shared._recall_inner_from_dsl_action( | ||
| run_action_details | ||
| ) | ||
| if eae_dict is not None: | ||
| exchange_account_after = ( | ||
| exchange_account_elements_import.ExchangeAccountElements.from_dict(eae_dict) | ||
| ) | ||
| last_six_count = len(exchange_account_after.orders.open_orders) | ||
| if last_six_count >= 6: | ||
| break | ||
| await asyncio.sleep(octobot_process_functional_shared.GRID_ORDERS_POLL_SEC) | ||
| else: | ||
| pytest.fail( | ||
| f"Timed out waiting for six open orders after config refresh " | ||
| f"(last count={last_six_count})" | ||
| ) | ||
| assert exchange_account_after is not None | ||
| assert inner_after is not None | ||
| _assert_three_by_three_grid_ladder_orders( | ||
| exchange_account_after.orders.open_orders, | ||
| ) | ||
|
|
||
| # After refresh, expect a new managed child PID (extra spawn in step 5). | ||
| refreshed_pid = int(inner_after["pid"]) |
Comment on lines
+392
to
+394
| "run_octobot_process(user_folder='bots/b1', profile_data={...}, " | ||
| "exchange_auth_data=[{'internal_name': 'binance', 'api_key': '...', 'api_secret': '...'}], " | ||
| "last_execution_result=None)" |
Member
Author
|
PR is up ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
requires #3420